package com.auto.survey.activity.monitoring.entity

import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey

/**
 * 测量次数实体类，对应数据库中的ATS_MeasurementCount表
 * 记录每个测点的测量次数和相关统计信息
 */
@Entity(
    tableName = "C",
    foreignKeys = [
        ForeignKey(
            entity = MonitoringPoint::class,
            parentColumns = ["pointId"],
            childColumns = ["pointId"],
            onDelete = ForeignKey.CASCADE
        )
    ],
    indices = [Index(value = ["pointId"])]
)
data class ATS_MeasurementCount(
    /**
     * 测量次数ID，主键，自增长
     */
    @PrimaryKey(autoGenerate = true) val countId: Int = 0,
    /**
     * 关联的测点ID，外键关联ATS_POINT表
     */
    val pointId: Int,
    /**
     * 测量次数
     */
    val measurementCount: Int,
    /**
     * 最后测量时间，格式：YYYY-MM-DD HH:MM:SS
     */
    val lastMeasurementTime: String,
    /**
     * 操作人员
     */
    val operator: String? = null,
    /**
     * 测量设备ID
     */
    val deviceId: String? = null,
    /**
     * 是否已同步（true:已同步，false:未同步）
     */
    val isSynchronized: Boolean = false
)